package com.bjpowernode.controllers;

import com.bjpowernode.querys.NameValueDataQuery;
import com.bjpowernode.querys.SummaryDataQuery;
import com.bjpowernode.result.Result;
import com.bjpowernode.services.StatisticService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class StatisticController {
    @Resource
    private StatisticService statisticService;

    @GetMapping("api/summary/data")
    public Result getSummaryData() {
        SummaryDataQuery summaryDataQuery = statisticService.getSummaryData();
        return Result.OK(summaryDataQuery);
    }

    @GetMapping(value = "/api/sale/funnel")
    public Result getSaleFunnelData() {
        List<NameValueDataQuery> nameValueDataQueryList = statisticService.getSaleFunnelData();
        return Result.OK(nameValueDataQueryList);
    }

    @GetMapping(value = "/api/clue/pie")
    public Result getCluePieData() {
        List<NameValueDataQuery> nameValueDataQueryList = statisticService.getCluePieData();
        return Result.OK(nameValueDataQueryList);
    }
}
